package com.zlm.qsmanage.controller;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zlm.qsmanage.common.Result;
import com.zlm.qsmanage.entity.User;
import com.zlm.qsmanage.utils.TokenUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

@RestController
@RequestMapping("/echarts")
public class EchartsController {
    Random random = new Random();

    //温度
    Object temperature_1 = random.nextInt(15)+10;
    Object temperature_2 = random.nextInt(15)+10;
    Object temperature_3 = random.nextInt(15)+5;
    Object temperature_4 = random.nextInt(15)+5;
    Object temperature_5 = random.nextInt(15)+5;
    Object temperature_6 = random.nextInt(15)+10;
    Object temperature_7= random.nextInt(15)+15;

    //光照强度
    int light_1 = random.nextInt(400)+140;
    int light_2 = random.nextInt(400)+140;
    int light_3 = random.nextInt(400)+140;
    int light_4 = random.nextInt(400)+140;
    int light_5 = random.nextInt(400)+140;
    int light_6 = random.nextInt(400)+140;
    int light_7 = random.nextInt(400)+140;

    //氨气浓度
    int ammonia_concentration_1 = random.nextInt(15)+5;
    int ammonia_concentration_2 = random.nextInt(15)+5;
    int ammonia_concentration_3 = random.nextInt(15)+5;
    int ammonia_concentration_4 = random.nextInt(15)+5;
    int ammonia_concentration_5 = random.nextInt(15)+5;
    int ammonia_concentration_6 = random.nextInt(15)+5;
    int ammonia_concentration_7 = random.nextInt(15)+5;

    //湿度
    int humidity_1 = random.nextInt(50)+30;
    int humidity_2 = random.nextInt(50)+30;
    int humidity_3 = random.nextInt(50)+30;
    int humidity_4 = random.nextInt(50)+30;
    int humidity_5 = random.nextInt(50)+30;
    int humidity_6 = random.nextInt(30)+40;
    int humidity_7 = random.nextInt(30)+40;

    @GetMapping("/example")
    public Result get(){
        Map<String,Object> map = new HashMap<>();
        map.put("x", CollUtil.newArrayList("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"));
        map.put("y", CollUtil.newArrayList( light_1, light_2, light_3, light_4, light_5, light_6, light_7));
//        System.out.println("到这里了吗============================================================"+temperature_day);
        return Result.success(map);
    }
    @GetMapping("/members")
    public Result members() {

        Map<String,Object> map = new HashMap<>();
        map.put("x", CollUtil.newArrayList("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"));
        map.put("y2", CollUtil.newArrayList( humidity_1, humidity_2, humidity_3, humidity_4, humidity_5, humidity_6, humidity_7));
//        System.out.println("??????????==========================================================="+temperature_day);
        return Result.success(map);
    }
    @GetMapping("/weche")
    public Result memberss() {

        Map<String,Object> map = new HashMap<>();
        map.put("x", CollUtil.newArrayList("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"));
        map.put("qw", CollUtil.newArrayList( temperature_1, temperature_2, temperature_3, temperature_4, temperature_5, temperature_6, temperature_7));
//        System.out.println("??????????==========================================================="+temperature_day);
        return Result.success(map);
    }
    @GetMapping("/membersss")
    public Result membersss() {

        Map<String,Object> map = new HashMap<>();
        map.put("x", CollUtil.newArrayList("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"));
        map.put("y4", CollUtil.newArrayList( ammonia_concentration_1, ammonia_concentration_2, ammonia_concentration_3, ammonia_concentration_4,
                ammonia_concentration_5, ammonia_concentration_6, ammonia_concentration_7));
//        System.out.println("??????????==========================================================="+temperature_day);
        return Result.success(map);
    }





}
